;##################################
;命令：
;nasm -f elf64 day30_0load_2vmovups.asm -o main.o && gcc main.o -o main -lc -no-pie && ./main
;输出：
;Value in arr[0] is 5.555500.
;Value in arr[1] is 6.666600.
;Value in arr[2] is 7.777700.
;Value in arr[3] is 8.888800.
;##################################
extern printf

section .data
	msg: db `Value in arr[%d] is %f.\n`, 0
	arr: dd 0.0000, 1.1111, 2.2222, 3.3333, 4.4444, 5.5555, 6.6666, 7.7777, 8.8888, 9.9999, 10.0000, 11.1111, 12.2222, 13.3333, 14.4444, 15.5555

section .text
	global main

main:
	push rbp
	mov rbp, rsp

;####################################################################################
	;load a[5] a[6] a[7] a[8]，并放到向量寄存器xmm0中
	;vmovsd会load连续的四个数组
	vmovups xmm0, [arr + 4 * 5]
	vmovups [arr], xmm0
;####################################################################################

	;打印
	mov ebx, 0
	jmp compare

execute:
	mov rdi, msg
	movsxd rsi, ebx
	cvtss2sd xmm0, dword [arr + 4 * ebx]
	movq rdx, xmm0
	call printf

	inc ebx

compare:
	cmp ebx, 4
	jl execute

	mov eax, 0
	leave
	ret
